package stud.cj.day16;

public class IntegerCompareDemo {
    public static void main(String[] args) {
        //int->Integer类型
        //为true的范围是在[-128,127]
        Integer x = Integer.valueOf(-128);
        Integer y = Integer.valueOf(-128);
        System.out.println(x == y);

        //封箱 - int => Integer

        //底层实际上就是在调用valueOf
        //Integer m = Integer.valueOf(128);
        Integer m = 128;
        Integer n = 128;
        System.out.println(m == n);

        Integer i = new Integer(10);
        Integer j = new Integer(10);
        System.out.println(i == j);//false

        int t = 10;
        //将包装类型和基本类型进行比较的时候,包装类型底层调用intValue方法=>基本数据类型
        System.out.println(i == t);//true
    }
}
